package chapter21.section3;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by lzy
 * Date: 2018/6/4
 */
public class AtomicEvenGenerator extends IntGenerator {
    private final AtomicInteger currentEvenValue = new AtomicInteger(0);

    public static void main(String[] args) {
        EventChecker.test(new AtomicEvenGenerator());
    }

    @Override
    public int next() {
        return currentEvenValue.addAndGet(2);
    }
}
